// 属性列表
controllers.controller('rebateInfoCtrl', ['$scope', '$http', '$rootScope', '$modal', '$window', 'RebateInfo', 'AlertService',
    function ($scope, $http, $rootScope, $modal, $window, RebateInfo, AlertService) {
        $scope.resetCurrentPageName("返佣管理");
        $scope.pageSize = 10;
        $scope.currentPage = 1;
        $scope.rebateInfoList = RebateInfo.rebateInfoList;
        $scope.disburseNo;
        $scope.status;
        $scope.currentProperty = RebateInfo.currentProperty;

        $scope.queryList = function () {
        	RebateInfo.queryList($scope.disburseNo, $scope.status, $scope.currentPage, $scope.pageSize, function () {
                $scope.totalItems = RebateInfo.totalSceneCount;
            });
        };
        
        $scope.confirmRechargeOrder = function (rechargeOrderNo) {
        	RechargeOrder.confirmRechargeOrder(rechargeOrderNo, function () {
            });
        };
        
        $scope.queryList();

        var operateTemplate = "<button class='btn btn-primary btn-sm' ng-click='grid.appScope.confirmRechargeOrder(row.entity.rechargeOrderNo)'>确认</button>";

        $scope.gridOptions = {
            data: 'rebateInfoList',
            enableColumnMenus: false,
            enableColumnResizing: true,
            rowHeight: 40,
            columnDefs: [
                {field: 'disburseNo', displayName: '消费订单号', width: 210},
                {field: 'itemId', displayName: '商品ID', width: 100},
                {field: 'rebateAmount', displayName: '返利金额', width: 80},
                {field: 'formula', displayName: '充值金额', width: 140},
                {field: 'statusName', displayName: '状态', width: 80},
                {field: 'timeAddStr', displayName: '添加时间', width: 160},
                {field: 'timeEditStr', displayName: '修改时间', width: 80},
                {
                    field: 'id',
                    displayName: '操作',
                    width: "200",
                    cellTemplate: operateTemplate
                }
            ]
        };
    }]);
